
function getlocalIP() {
    const ifaces = require('os').networkInterfaces();
    let ipAddress = '';
    for (let dev in ifaces) {
        let alias = 0;
        ifaces[dev].forEach(function (details) {
            if (details.family === 'IPv4' && !details.internal) {
                if (alias >= 1) {
                    //console.log(dev + ':' + alias, details.address);
                } else {
                    //console.log(dev, details.address);
                    return ipAddress = details.address;
                }
                ++alias;
            }
        });
    }
    return ipAddress;
}

global.wsPort = 8182
global.httpPort = 8848
global.localIP = getlocalIP()

const dbUtils = require('./database/utils')
const web = require('./server/webServer')
const wss = require('./server/wssServer')

var start = async function () {
    await dbUtils.dbInit()
}

start()